package com.huluobo.lib_base.room

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query

/**
 *  Created by LC on 2025/8/21.
 *  DAO
 *  D database 数据库
 *  A access 转化
 *  O object 对象
 */
@Dao
interface UserDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun register(user: User): Long

    @Query("select * from user_info where username=:username and password=:password and role=:role")
    fun login(username: String, password: String, role: Int): User

    @Query("select * from user_info")
    fun queryAllUser(): List<User>

    //删除需要完全符合user对象,id必须要有
    @Delete
    fun deleteUser(user: User)
}